home *** CD-ROM | disk | FTP | other *** search
/ MacHack 2000 / MacHack 2000.toast / pc / The Hacks / MacHacksBug / Python 1.5.2c1 / Lib / test / output / test_MimeWriter / doubleCR.1 < prev   
Encoding:
Text File  |  2000-06-23  |  2.2 KB  |  102 lines

  1. This is a multi-part message in MIME format.
  2.  
  3. --801spam999
  4. Content-Type: multipart/knowbot-metadata;
  5.     boundary="802spam999"
  6.  
  7.  
  8. --802spam999
  9. Content-Type: message/rfc822
  10. KP-Metadata-Type: simple
  11. KP-Access: read-only
  12.  
  13. KPMD-Interpreter: python
  14. KPMD-Interpreter-Version: 1.3
  15. KPMD-Owner-Name: Barry Warsaw
  16. KPMD-Owner-Rendezvous: bwarsaw@cnri.reston.va.us
  17. KPMD-Home-KSS: kss.cnri.reston.va.us
  18. KPMD-Identifier: hdl://cnri.kss/my_first_knowbot
  19. KPMD-Launch-Date: Mon Feb 12 16:39:03 EST 1996
  20.  
  21. --802spam999
  22. Content-Type: text/isl
  23. KP-Metadata-Type: complex
  24. KP-Metadata-Key: connection
  25. KP-Access: read-only
  26. KP-Connection-Description: Barry's Big Bass Business
  27. KP-Connection-Id: B4
  28. KP-Connection-Direction: client
  29.  
  30. INTERFACE Seller-1;
  31.  
  32. TYPE Seller = OBJECT
  33.     DOCUMENTATION "A simple Seller interface to test ILU"
  34.     METHODS
  35.             price():INTEGER,
  36.     END;
  37.  
  38. --802spam999
  39. Content-Type: message/external-body;
  40.     access-type="URL";
  41.     URL="hdl://cnri.kss/generic-knowbot"
  42.  
  43. Content-Type: text/isl
  44. KP-Metadata-Type: complex
  45. KP-Metadata-Key: generic-interface
  46. KP-Access: read-only
  47. KP-Connection-Description: Generic Interface for All Knowbots
  48. KP-Connection-Id: generic-kp
  49. KP-Connection-Direction: client
  50.  
  51.  
  52. --802spam999--
  53.  
  54. --801spam999
  55. Content-Type: multipart/knowbot-code;
  56.     boundary="803spam999"
  57.  
  58.  
  59. --803spam999
  60. Content-Type: text/plain
  61. KP-Module-Name: BuyerKP
  62.  
  63. class Buyer:
  64.     def __setup__(self, maxprice):
  65.         self._maxprice = maxprice
  66.  
  67.     def __main__(self, kos):
  68.         """Entry point upon arrival at a new KOS."""
  69.         broker = kos.broker()
  70.         # B4 == Barry's Big Bass Business :-)
  71.         seller = broker.lookup('Seller_1.Seller', 'B4')
  72.         if seller:
  73.             price = seller.price()
  74.             print 'Seller wants $', price, '... '
  75.             if price > self._maxprice:
  76.                 print 'too much!'
  77.             else:
  78.                 print "I'll take it!"
  79.         else:
  80.             print 'no seller found here'
  81.  
  82. --803spam999--
  83.  
  84. --801spam999
  85. Content-Type: multipart/knowbot-state;
  86.     boundary="804spam999"
  87. KP-Main-Module: main
  88.  
  89.  
  90. --804spam999
  91. Content-Type: text/plain
  92. KP-Module-Name: main
  93.  
  94. # instantiate a buyer instance and put it in a magic place for the KOS
  95. # to find.
  96. __kp__ = Buyer()
  97. __kp__.__setup__(500)
  98.  
  99. --804spam999--
  100.  
  101. --801spam999--
  102. ˇ